<div id="content" style="position: relative;min-height: 100%;">
	<div id="fix_overflow" style="overflow: initial;">
		<div class="row s_page_title">
			<sa-big-breadcrumbs [items]="['项目管理','项目报表统计']" icon="fa fa-smile-o" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
		</div>
		<sa-widgets-grid>
			<div class="s_table">
				<div sa-widget [editbutton]="false" color="darken" class="clearfix">
					<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>项目报表统计</h2></header>
					<div>
						<div class="widget-body no-padding">
							<div class="page-header clearfix s_table_opreation" style="position: relative;">
								<div class="left page-header-btn" style="width: calc(100% - 220px);">
									<div class="top_module">
										<span class="module_text">项目名称</span>
										<div class="s_hover_box">
											<select class="select2" id="companySelect2">
												<option value=''></option>
											</select>
											<div class="s_del_icon" (click)='delCompany()'>x</div>
										</div>
									</div>
									<!-- <div class="top_module">
										<span class="module_text">项目名称</span>
										<sa-company-tree companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree>
									</div> -->
									<div class="selectDate top_module">
										<span class="module_text" style="position: relative;top: -14px;">选择时间</span>
										<div class="input-daterange input-group s_selected_time_box s_hover_box">
											<input type="text" class="form-control s_selected_time" id="datetimepicker1"  autocomplete="off" placeholder="选择时间"/>
											<!-- <span class="s_selected_time_spe">至</span>
											<input type="text" [(ngModel)]='endTime' class="form-control s_selected_time" id="datetimepicker2"  autocomplete="off" placeholder="选择结束时间"/> -->
											<div class="s_del_icon" (click)='del_date()'>x</div>
										</div>
										<input type="text" disabled class="module_inp top_module_select TimeSuggest" [(ngModel)]="TimeSuggest"/>
									</div>
									<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
									<button type="button" class="btn btn-primary" (click)="projectExportReport(projectCountModal)">项目统计</button>
								</div>
								<div class="right top-search" style="width:220px">
									<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="项目名称">
									<span class="top-search-box">
										<button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
									</span>
								</div>
							</div>
							<div class="" style="">
								<ul class="nav nav-tabs" id="myTab" style="padding-left:12px;background-image: linear-gradient(#F1F5FD, #E9F0FF);padding: 0;">
									<li class="active s-lis"><a data-toggle="tab" href="#sensorProblem" (click)="btnClick('sensorProblem')">传感器问题统计&nbsp;&nbsp;<span class="red">{{tabNumberList[0]}}</span></a></li>
									<li class="s-lis"><a data-toggle="tab" href="#gpsProblem" (click)="btnClick('gpsProblem')">GPS问题统计&nbsp;&nbsp;<span class="red">{{tabNumberList[1]}}</span></a></li>
									<li class="s-lis"><a data-toggle="tab" href="#repairCount" (click)="btnClick('repairCount')">待维修报表统计&nbsp;&nbsp;<span class="red">{{tabNumberList[2]}}</span></a></li>
									<li class="s-lis"><a data-toggle="tab" href="#orderCount" (click)="btnClick('orderCount')">订单周报统计&nbsp;&nbsp;<span class="red">{{tabNumberList[3]}}</span></a></li>
									<li class="s-lis"><a data-toggle="tab" href="#deviceOffLine" (click)="btnClick('deviceOffLine')">红狮传感器问题统计&nbsp;&nbsp;<span class="red">{{tabNumberList[4]}}</span></a></li>
								</ul>
							</div>
							<div class="table_scroll">
								<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
									<thead>
										<tr>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount'">项目</th>
											<th *ngIf="btnNum == 'deviceOffLine'">通道数</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'deviceOffLine'">台数</th>
											<th *ngIf="btnNum == 'orderCount'">订单总数</th>
											<th *ngIf="btnNum == 'orderCount'">正常</th>
											<th *ngIf="btnNum == 'orderCount'">离线</th>
											<th *ngIf="btnNum == 'orderCount'">GPS问题</th>
											<th *ngIf="btnNum == 'orderCount'">数据异常</th>
											<th *ngIf="btnNum == 'orderCount'">正常率</th>
											<th *ngIf="btnNum == 'orderCount'">异常率</th>
											<th *ngIf="btnNum == 'repairCount'">车辆总数</th>
											<th *ngIf="btnNum == 'repairCount'">离线</th>
											<th *ngIf="btnNum == 'repairCount'">GPS</th>
											<th *ngIf="btnNum == 'repairCount'">传感器</th>
											<th *ngIf="btnNum == 'repairCount'">线材</th>
											<th *ngIf="btnNum == 'repairCount'">其他</th>
											<th *ngIf="btnNum == 'gpsProblem'">无GPS</th>
											<th *ngIf="btnNum == 'gpsProblem'">停车速度平直</th>
											<th *ngIf="btnNum == 'gpsProblem'">大段丢失</th>
											<th *ngIf="btnNum == 'gpsProblem'">偶尔丢失</th>
											<th *ngIf="btnNum == 'gpsProblem'">GPS问题总计</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">传感器个数</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">正负52万</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">经常52万</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">偶尔52万</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">乱跳</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">形变小</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">方向反</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">平直</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">传感器问题总计</th>
											<th *ngIf="btnNum == 'repairCount'">总计</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'deviceOffLine'">问题占比</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">环比</th>
											<th *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'deviceOffLine'">上周</th>
											<th *ngIf="btnNum == 'orderCount'">上周异常率</th>
										</tr>
									</thead>
									<tbody>
										<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i">
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount'">{{row.projectName}}</td>
											<td *ngIf="btnNum == 'orderCount'">{{row.orderTotalCount}}</td>
											<td *ngIf="btnNum == 'deviceOffLine'">{{row.channelsName}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'deviceOffLine'">{{row.carTotalCount}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">{{row.sensorCount}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">{{row.problem1Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">{{row.problem6Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">{{row.problem7Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">{{row.problem2Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">{{row.problem3Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">{{row.problem4Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'repairCount' || btnNum == 'deviceOffLine'">{{row.problem5Count}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'deviceOffLine'">{{row.sensorProblemTotalCount}}</td>
											<td *ngIf="btnNum == 'gpsProblem'">{{row.gpsProblemTotalCount}}</td>
											<td *ngIf="btnNum == 'repairCount'">{{row.problemTotalCount}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'deviceOffLine'">{{row.percentage}}</td>
											<td *ngIf="btnNum == 'orderCount'">{{row.normalRate}}</td>
											<td *ngIf="btnNum == 'orderCount'">{{row.exceptionRate}}</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">
												<span *ngIf="row.chainRatio == 0">0</span>
												<span *ngIf="row.chainRatio != 0">
													<i *ngIf="row.isUp" class="fa fa-arrow-up" style="color: limegreen;"></i>
													<i *ngIf="!row.isUp" class="fa fa-arrow-down" style="color:sienna;"></i>
													{{row.chainRatio}}
												</span>
											</td>
											<td *ngIf="btnNum == 'sensorProblem' || btnNum == 'gpsProblem' || btnNum == 'repairCount' || btnNum == 'orderCount' || btnNum == 'deviceOffLine'">{{row.lastWeekPercentage}}
											</td>
										</tr>
									</tbody>
								</table>
							</div>
							<div class="table-fix clearfix">
								<paginator [totalRecords]="totalCounts"
							           [rows]="pageSize"
							           [currentPage]="curPage - 1"
							           (onPageChange)="paginate($event)">
								</paginator>
								<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</sa-widgets-grid>
		<!-- 项目统计   弹窗-->
	<section bsModal #projectCountModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg" style="width: 800px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(projectCountModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">项目统计</h4>
				</div>
				<form id="projectCount" class="form-horizontal" role="form" novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
					<div class="modal-body">
						<div class="row form-horizontal">

							<div class="form-group col-xs-12">
								<label class="control-label col-xs-4 col-sm-2">项目名称<sup>*</sup></label>
								<div class="col-xs-10">
									<div class="clearfix fix_select2">
										<input type="hidden"  class="form-control" id="polishInstallerInput" name="polishInstallerInput" [(ngModel)]='projectCount.companyIds'>
										<select id="polishSelect2" style="width:100%" name="polishInstaller" class="form-control select2"  multiple placeholder="请选择项目名称"></select>
									</div>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="control-label col-xs-4 col-sm-2">开始时间<sup>*</sup></label>
								<div class="col-xs-10">
									<input class="form-control" name="startTime" [(ngModel)]='projectCount.startTime' onfocus="this.blur()" id="workStartTime" autocomplete="off" placeholder="开始时间" />
								</div>
							</div>

							<div class="form-group col-xs-12">
								<label class="control-label col-xs-4 col-sm-2">结束时间<sup>*</sup></label>
								<div class="col-xs-10">
									<input class="form-control" name="endTime" [(ngModel)]='projectCount.endTime' onfocus="this.blur()" id="workEndTime" autocomplete="off" placeholder="结束时间" />
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" (click)="modalClose(projectCountModal)">取消</button>
						<button type="button" class="btn btn-primary" (click)="projectCountSubmit(projectCountModal)">导出</button>
					</div>
				</form>

			</div>
		</div>
	</section>
	<!-- 项目统计 弹窗end-->
	</div>
</div>
<style>
	.TimeSuggest{
		width: 270px;
		height: 28px;
		position: relative;
		top: 0px;
		left: 2px;
	}
</style>

